Option Strict On
Option Explicit On

Imports System

Public Class Attribute
   Private mValue As String
   Private mName As String
   Private mNamespaceUri As String
   Private mNamespacePrefix As String
   ' TODO: Consider whether a namespace is useful

   Public Sub New( _
            ByVal namespaceUri As String, _
            ByVal namespacePrefix As String, _
            ByVal name As String, _
            ByVal value As String)
      Me.mNamespaceUri = namespaceUri
      Me.mNamespacePrefix = namespacePrefix
      Me.mName = name
      Me.mValue = value
   End Sub

   Public Property Value() As String
      Get
         Return mValue
      End Get
      Set(ByVal value As String)
         mValue = value
      End Set
   End Property

   Public Property Name() As String
      Get
         Return mName
      End Get
      Set(ByVal value As String)
         mName = value
      End Set
   End Property

   Public Property NamespaceUri() As String
      Get
         Return mNamespaceUri
      End Get
      Set(ByVal value As String)
         mNamespaceUri = value
      End Set
   End Property

   Public Property NamespacePrefix() As String
      Get
         Return mNamespacePrefix
      End Get
      Set(ByVal value As String)
         mNamespacePrefix = value
      End Set
   End Property
End Class

Public Class Attributes
   Inherits List(Of Attribute)

   Public Function GetItem( _
            ByVal namespaceUri As String, _
            ByVal namespacePrefix As String, _
            ByVal name As String) As Attribute
      For Each attr As Attribute In Me
         If attr.NamespaceUri = namespaceUri AndAlso attr.NamespacePrefix = namespacePrefix AndAlso attr.Name = name Then
            Return attr
         End If
      Next
      Return Nothing
   End Function
End Class
